import urllib.request


BASE_URL = 'http://www.notfound.com'
HEADER = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
}

try:
    requests = urllib.request.Request(url=BASE_URL, headers=HEADER)
    response = urllib.request.urlopen(requests)
    html = response.read().decode('UTF-8')
    print(html)
except urllib.error.HTTPError:
    print('urllib.error.HTTPError detect')

except urllib.error.URLError:
    print('urllib.error.URLError detect')

